package ruifeng.zcj.communcationring.ui.main.utils;

import android.content.Context;

import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;

/**
 * Created by Administrator on 2016/10/17 0017.
 */
public class Utils {
    private Utils() {
    }
    private static class UtilHodel {
        public static final Utils UTIL = new Utils();
    }
    public static Utils getInstance() {
        return UtilHodel.UTIL;
    }

    /**
     * 获取LocationClient
     *
     * @param mContext
     * @param listener
     *            BDLocationListener
     * @return
     */
    public LocationClient getLocationClient(Context mContext, BDLocationListener listener) {
        LocationClient mClient = new LocationClient(mContext);
        mClient.registerLocationListener(listener);
        LocationClientOption option = new LocationClientOption();
        option.setOpenGps(true);// 打开gps
        option.setCoorType("bd09ll"); // 设置坐标类型
        option.setIsNeedAddress(true);
        option.setLocationMode(com.baidu.location.LocationClientOption.LocationMode.Hight_Accuracy);
        mClient.setLocOption(option);
        return mClient;
    }
}
